﻿using System;
using System.Linq;
using System.Xml.Linq;

using FirstFloor.Documents;
using FirstFloor.Documents.Annotations.Storage;
using System.Windows.Media;

namespace SampleBrowser.Common.Annotations
{
    /// <summary>
    /// Reads and writes strikethrough annotations.
    /// </summary>
    /// <remarks>
    /// The strikethrough factory provides persistence to an XML based store.
    /// </remarks>
    public class StrikethroughFactory
        : TextAnnotationFactory<Strikethrough>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="UnderlineFactory"/> class.
        /// </summary>
        public StrikethroughFactory()
            : base(Strikethrough.TypeStrikethrough)
        {
        }

        /// <summary>
        /// Creates the annotation.
        /// </summary>
        /// <returns>The annotation.</returns>
        public override Strikethrough CreateAnnotation()
        {
            return new Strikethrough();
        }

        /// <summary>
        /// Reads the annotation properties.
        /// </summary>
        /// <param name="annotation">The annotation.</param>
        /// <param name="source">The source.</param>
        protected override void ReadAnnotationProperties(Strikethrough annotation, XElement source)
        {
            // nothing here, strikethrough doesn't have additional properties
        }

        /// <summary>
        /// Writes the annotation properties.
        /// </summary>
        /// <param name="annotation">The annotation.</param>
        /// <param name="target">The target.</param>
        protected override void WriteAnnotationProperties(Strikethrough annotation, XElement target)
        {
            // nothing here, strikethrough doesn't have additional properties
        }
    }
}
